package com.ruoyi.web.controller.culturalyard;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.vo.CameraVO;
import com.ruoyi.common.core.domain.vo.YardVO;
import com.ruoyi.system.service.YardService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/yard")
public class YardController extends BaseController{
    private static final Logger log = LoggerFactory.getLogger(YardController.class);

    @Autowired
    private YardService yardService;

    /**
     * 返回所有小院与常时监控区，连同它拥有的监控
     * @return
     */
    @GetMapping("/list")
    public AjaxResult listWithMonitor(){
        log.info("查询所有小院与常时监控区，并返回它拥有的监控");
        List<YardVO> yardVOS = yardService.listWithCameras();
        return AjaxResult.success(yardVOS);
    }

    /**
     * 返回该小院的置顶摄像头
     * @param id  小院id
     * @return
     */
    @GetMapping("/TopStatus/{id}")
    public AjaxResult listWithMonitor(@PathVariable String id){
        log.info("查询小院下的置顶监控：{}",id);
        return AjaxResult.success(yardService.selectTopCamera(id));
    }
}
